API Documentation
Public Member Functions | List of all members
nkGraphics::MeshManager Class Referencefinal

Manages the meshes available in the component. More...

Inheritance diagram for nkGraphics::MeshManager:

Public Member Functions

 ~MeshManager ()
 
MeshcreateOrRetrieve (const std::string_view &name)
 
Meshget (const std::string_view &name) const
 
MeshgetByIndex (unsigned int index) const
 
void rename (const std::string_view &currentName, const std::string_view &newName)
 
void erase (const std::string_view &name)
 

Detailed Description

Manages the meshes available in the component.

The manager owns all memory allocated inside. External code should never delete it.

Constructor & Destructor Documentation

◆ ~MeshManager()

nkGraphics::MeshManager::~MeshManager ( )

Destructor.

Member Function Documentation

◆ createOrRetrieve()

Mesh* nkGraphics::MeshManager::createOrRetrieve ( const std::string_view &  name)

Creates if unavailable, or retrieves if available, a mesh.

Parameters
nameThe name of the mesh to retrieve.
Returns
The mesh requested, possibly freshly created. The manager owns the memory returned, external code should never free it. See erase().

◆ get()

Mesh* nkGraphics::MeshManager::get ( const std::string_view &  name) const

Retrieves an existing mesh.

Parameters
nameThe name of the mesh to retrieve.
Returns
The mesh requested if available, nullptr else.

◆ getByIndex()

Mesh* nkGraphics::MeshManager::getByIndex ( unsigned int  index) const

Retrieves a mesh by index. Note that an index can be attached to different meshes as the internal memory gets updated. Mainly used to go over all meshes in one go.

Parameters
indexThe index of the mesh to retrieve.
Returns
The mesh requested if available, nullptr else.

◆ rename()

void nkGraphics::MeshManager::rename ( const std::string_view &  currentName,
const std::string_view &  newName 
)

Renames a mesh, changing both its name and the way to access it through the manager.

Parameters
currentNameThe name of the mesh to rename.
newNameThe new name to assign to it.

◆ erase()

void nkGraphics::MeshManager::erase ( const std::string_view &  name)

Erases and frees the memory of a mesh.

Parameters
nameThe name of the mesh to erase.

The documentation for this class was generated from the following file: